/****************************************************
	文件：CustomRenderPipelineAsset.cs
	作者：HuskyT
	邮箱：1005240602@qq.com
	日期：2020/9/9 17:11:2
	功能：创建自定义渲染管线Asset
*****************************************************/

using System;
using UnityEngine;
using UnityEngine.Rendering;

namespace LearningSRP
{
    /// <summary>
    /// 提供给Unity，作用：让Unity获取自定义渲染管线实例
    /// </summary>
    [CreateAssetMenu(menuName = CREATE_CUSTOM_RP_MENU_PATH)]
    public class CustomRenderPipelineAsset : RenderPipelineAsset
    {
        /// <summary>
        /// 创建自定义渲染管线资产的路径
        /// </summary>
        public const string CREATE_CUSTOM_RP_MENU_PATH = "Rendering/Custom Render Pipeline";

        //注：GPU实例 和 动态批处理 不能同时使用
        [SerializeField, Tooltip("SRP批处理")]
        private bool mUseSRPBatcher = true;
        [SerializeField, Tooltip("动态批处理")]
        private bool mUseDynamicBatching = false;
        [SerializeField, Tooltip("GPU实例")]
        private bool mUseGPUInstancing = true;
        [SerializeField, Tooltip("阴影设置")]
        private ShadowSettings mShadowSettings = default;

        /// <summary>
        /// 创建渲染管线
        /// </summary>
        /// <returns></returns>
        protected override RenderPipeline CreatePipeline()
        {
            return new CustomRenderPipeline(mUseSRPBatcher, mUseDynamicBatching, mUseGPUInstancing, mShadowSettings);
        }
    }
}
